/**
 * 
 */
package com.disys.facade;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.disys.dao.RecReferenceValueDAO;
import com.disys.model.Rec140ERWOTCLOC;
import com.disys.model.RecReferenceValue;

/**
 * @author Ubaid Raja
 * 
 */
public class RecReferenceValueFacade implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private RecReferenceValue objRecReferenceValue;
	private List<RecReferenceValue> listRecReferenceValues;
	private RecReferenceValueDAO objDao;

	public RecReferenceValueFacade() {
		objRecReferenceValue = new RecReferenceValue();
		listRecReferenceValues = new ArrayList<RecReferenceValue>();
		objDao = new RecReferenceValueDAO();
	}

//	public RecReferenceValue getSingleRecord(){
//		List<RecReferenceValue> list = null;
//		try{
//			objDao.beginTransaction();	
//			list = objDao.findAll();
//			objDao.closeTransaction();
//		}catch(IllegalStateException ex){
//			list = objDao.findAll();
//			objDao.closeTransaction();
//		}
//		if(list.size() ==0 || list == null){
//			return null;
//		}
//		return list.get(0);
//	}
	/**
	 * @return the objRecReferenceValue
	 */
	public RecReferenceValue getObjRecReferenceValue() {
		return objRecReferenceValue;
	}

	/**
	 * @param objRecReferenceValue
	 *            the objRecReferenceValue to set
	 */
	public void setObjRecReferenceValue(RecReferenceValue objRecReferenceValue) {
		this.objRecReferenceValue = objRecReferenceValue;
	}

	/**
	 * @return the listRecReferenceValues
	 */
	public List<RecReferenceValue> getListRecReferenceValues() {
		listRecReferenceValues = objDao.findAll();
		return listRecReferenceValues;
	}

	/**
	 * @param listRecReferenceValues
	 *            the listRecReferenceValues to set
	 */
	public void setListRecReferenceValues(
			List<RecReferenceValue> listRecReferenceValues) {
		this.listRecReferenceValues = listRecReferenceValues;
	}

	/**
	 * @return the objDao
	 */
	public RecReferenceValueDAO getObjDao() {
		return objDao;
	}

	/**
	 * @param objDao
	 *            the objDao to set
	 */
	public void setObjDao(RecReferenceValueDAO objDao) {
		this.objDao = objDao;
	}

	public List<RecReferenceValue> findSupportingValues(String object,
			String recordType) {
		return objDao.findSupportingValues(object, recordType);
	}

	public void updateReferences(String object, String columnName,
			String columnValue, String recordType) {
		objDao.beginTransaction();
		objDao.updateReferences(object, columnName, columnValue, recordType);
		objDao.commit();
	}

}
